//
//  Config.cpp
//  AdvPropTestsCpp
//
//  Created by Brian Bogard on 2/23/12.
//  Copyright 2012 ASU. All rights reserved.
//

#include <iostream>
#include "PropTesterConfig.h"
#include "ConfigConstants.h"

using namespace ConfigConstants;

PropTesterConfig::PropTesterConfig( const char * _configFile ):
    m_config ( new Config() )
{
    m_config->readFile( _configFile );
    m_testerConfigRoot = & m_config->getRoot()[ "PropConfig" ];
}

int PropTesterConfig::getNumberOfGraphs() const
{
    int numOfGraphs;
    if( ! m_testerConfigRoot->lookupValue( NUMBER_OF_GRAPHS, numOfGraphs ) )
        numOfGraphs = DEFAULT_NUMBER_OF_GRAPHS;
    
    return numOfGraphs;
}

int PropTesterConfig::getInitRedSelect() const
{
    int initRedSelect;
    if( ! m_testerConfigRoot->lookupValue( INIT_RED_SELECT, initRedSelect ) )
        initRedSelect = DEFAULT_INIT_RED_SELECT;
    
    return initRedSelect;
}

float PropTesterConfig::getActiveEdgeProb() const
{
    float activeEdgeProb;
    if( ! m_testerConfigRoot->lookupValue( ACTIVE_EDGE_PROB, activeEdgeProb ) )
        activeEdgeProb = DEFAULT_ACTIVE_EDGE_PROB;
    
    return activeEdgeProb;
}
